package com.demo.controller;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;
import com.demo.constant.ErrorInfo;
import com.demo.dto.AccessToken;
import com.demo.kit.StrKit;
import com.demo.model.Role;
import com.demo.model.User;
import com.demo.validator.user.GetOrDel;
import com.demo.validator.user.Login;
import com.demo.validator.user.addOrUpdate;
import com.jfinal.aop.Before;
import com.jfinal.kit.Kv;
import com.jfinal.log.Log;
import com.jfinal.plugin.activerecord.Record;
import com.jfinal.plugin.activerecord.SqlPara;
import com.jfinal.plugin.redis.Redis;

public class RoleController extends BaseController {
	
	public void add(){
		Role role = getModel(Role.class, "");
		record = role.getById(role.getId());
		if (record == null) {
			renderDataJson(ErrorInfo.ERR_ROLE_DOES_NOT_EXIST);
			return;
		}
		if (!role.checkRoleName(role)) {
			renderDataJson(ErrorInfo.ERR_ROLENAME_NOT_DUPLICATE);
			return;
		}
		role.save();
		renderDataJson(ErrorInfo.ERR_SUCCESS, role);
	}
	
	public void delete(){
		
	}
	
	public void update(){
		
	}
	
	public void list(){
		
	}
}
